package com.lihaozhe.productservice.dto;

/**
 * 商品数据传输对象
 *
 * @author 李昊哲
 * @version 1.0.0
 */
public class ProductDTO {
  /**
   * 商品ID
   */
  private Long id;
  /**
   * 商品名称
   */
  private String name;
  /**
   * 商品分类
   */
  private String category;
  /**
   * 商品价格
   */
  private Double price;
  /**
   * 商品库存
   */
  private Integer stock;
  /**
   * 商品描述
   */
  private String description;

  // 构造函数
  public ProductDTO() {
  }

  public ProductDTO(String name, String category, Double price, Integer stock, String description) {
    this.name = name;
    this.category = category;
    this.price = price;
    this.stock = stock;
    this.description = description;
  }

  public ProductDTO(Long id, String name, String category, Double price, Integer stock, String description) {
    this.id = id;
    this.name = name;
    this.category = category;
    this.price = price;
    this.stock = stock;
    this.description = description;
  }

  // Getter和Setter方法
  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getCategory() {
    return category;
  }

  public void setCategory(String category) {
    this.category = category;
  }

  public Double getPrice() {
    return price;
  }

  public void setPrice(Double price) {
    this.price = price;
  }

  public Integer getStock() {
    return stock;
  }

  public void setStock(Integer stock) {
    this.stock = stock;
  }

  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  @Override
  public String toString() {
    return String.format("Product{id=%d, name='%s',category=%s price=%.2f, stock=%d}", id, name, category, price, stock);
  }

}
